package com.srv.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.srv.TheException;
import com.srv.model.ID;
import com.srv.model.User;
import com.srv.service.IDService;

import org.apache.commons.logging.Log; 
import org.apache.commons.logging.LogFactory;


/**
 * 对一个Travel打包.
 * @author Administrator
 *
 */
public class ServletTravelPackage extends HttpServlet {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1881111111L;
	private static Log log = LogFactory.getLog(ServletTravelPackage.class);

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		try{
			response.setContentType(ConstText.TextHtml);
			ResponseResult result = new ResponseResult();
			User theUser = RequestTool.getAccessUser(request);			
			//未登陆
			if(theUser==null){				
				result.theResult = ResponseResult.RESULT_FAIL;//结果失败
				result.theMessageObj = ConstText.NotLogin;
				ResponseTool.repsone(request,response,result);
				return;
			}	
			 //参数检查，id为travel的id
			 String tid = RequestTool.getValueOfID(request);							 
			 //检查ID是否合法
			 ID idObj = IDService.getID(tid);
			 if(idObj==null){
				 result.theResult = ResponseResult.RESULT_FAIL;//结果失败
				 result.theMessageObj=ConstText.ID_IS_INVALID;
				 ResponseTool.repsone(request,response,result);
				 return;		 
			 }
			 //包的格式，如何提供，需要细化.
			 //
			 //
			 //
			 //
		}catch(TheException te){
			log.error("error: "+te.getMessage());
		}
	}

}
